package java8_31;

/**
 * @author oldliu
 * @since 1.0
 */
public class USBStorage implements USB {
    private String brand;
    private int cap;//容量，单位是G

    public USBStorage(String brand, int cap) {
        this.brand = brand;
        this.cap = cap;
    }

    @Override
    public void plug() {
        System.out.println("品牌是"+brand+"，容量是"+cap+"G的u盘插在的USB口，新的盘符出现了，可以查看内容了。。。");
    }

    @Override
    public void unplug() {
        System.out.println("品牌是"+brand+"，容量是"+cap+"G的u盘从USB口移除，盘符消失");
    }
    public void read(){
        System.out.println("读U盘");
    }
    public void write(){
        System.out.println("写入U盘，写入了新的内容");
    }

    @Override
    public String toString() {
        return "这是一个容量是"+cap+"G，品牌是"+brand+"的U盘";
    }
}
